<?php

/**
 * This is the model class for table "termin".
 *
 * The followings are the available columns in table 'termin':
 * @property integer $id
 * @property integer $erstellerID
 * @property string $name
 * @property string $datum
 * @property string $zeit
 * @property integer $dauer
 * @property string $nachricht
 * @property integer $rueckmeldung
 * @property integer $share
 * @property string $zusagenID
 * @property string $absagenID
 * @property integer $deadline
 * @property string $termincol
 */
class Termin extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Termin the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'termin';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('erstellerID', 'required'),
			array('erstellerID, dauer, rueckmeldung, share, deadline', 'numerical', 'integerOnly'=>true),
			array('termincol', 'length', 'max'=>45),
			array('name, datum, zeit, nachricht, zusagenID, absagenID', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, erstellerID, name, datum, zeit, dauer, nachricht, rueckmeldung, share, zusagenID, absagenID, deadline, termincol', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'erstellerID' => 'Ersteller',
			'name' => 'Name',
			'datum' => 'Datum',
			'zeit' => 'Zeit',
			'dauer' => 'Dauer',
			'nachricht' => 'Nachricht',
			'rueckmeldung' => 'Rueckmeldung',
			'share' => 'Share',
			'zusagenID' => 'Zusagen',
			'absagenID' => 'Absagen',
			'deadline' => 'Deadline',
			'termincol' => 'Termincol',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('erstellerID',$this->erstellerID);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('datum',$this->datum,true);
		$criteria->compare('zeit',$this->zeit,true);
		$criteria->compare('dauer',$this->dauer);
		$criteria->compare('nachricht',$this->nachricht,true);
		$criteria->compare('rueckmeldung',$this->rueckmeldung);
		$criteria->compare('share',$this->share);
		$criteria->compare('zusagenID',$this->zusagenID,true);
		$criteria->compare('absagenID',$this->absagenID,true);
		$criteria->compare('deadline',$this->deadline);
		$criteria->compare('termincol',$this->termincol,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}